import { defineConfig } from 'vite'
import { resolve } from 'path'
import eslintPlugin from 'vite-plugin-eslint'

export default defineConfig({
  plugins: [
    eslintPlugin({
      include: ['./src/**/*.vue', './src/**/*.js'],
    }),
  ],
  resolve: {
    alias: {
      '~': resolve(__dirname, './'),
      '@': resolve(__dirname, './src'),
      '@utils': resolve(__dirname, './src/utils'),
    },
    extensions: ['.js', '.vue'],
  },
  build: {
    emptyOutDir: false,
    rollupOptions: {
      input: {
        background: resolve(__dirname, './src/chrome/background.js'),
        content: resolve(__dirname, './src/chrome/content.js'),
      },
      output: {
        format: 'es',
        entryFileNames: '[name].js',
        inlineDynamicImports: false,
      },
    },
  },
})
